﻿@using ZhouYu.DreamTour.Model;
@using ZhouYu.DreamTour.Web.Models;
@{
    var groupInfo = ViewBag.groupInfo as GroupInfo;
    var OutDate = groupInfo.StartTime.ToString("yyyy:MM:dd").Replace(":", "-");
    //儿童半价
    var childrenPrice = groupInfo.Price / 2;
    //成人个数
    var AdultNum = ViewBag.AdultNum;
    //儿童个数
    var childrenNum = ViewBag.childrenNum;
    //保险份数
    var Number = ViewBag.Number;
    //保险所需金额
    var xiaoji = ViewBag.xiaoji;
    //计算成人价格
    var AdultNumPirce = AdultNum * groupInfo.Price;
    //计算儿童价格
    var childrenNumPrice = childrenNum * childrenPrice;
    //总价
    var total = AdultNumPirce + childrenNumPrice + xiaoji;
    var UserInfo = UserInfoContext.userInfoContext.UserInfo;
}
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>行程导航-详情页</title>
    <link href="~/css/style.css" rel="stylesheet" type="text/css" />
    <link href="~/css/common.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="~/js/jquery-1.9.1.min.js"></script>
</head>
<body>
    <div class="top_hw clearfix">
        <div class="top_h clearfix">
            <div class="top_hl"><span>欢迎来到中国梦想游，让你的梦想全程免费自由行！</span> 预定热线：<b>0571-63322269</b></div>
            <div class="top_hr">
                @if (UserInfo == null)
                {
                    <a href="/Home/User_Register">会员注册</a>
                    <span>|</span> <a href="/Home/User_Login">登录</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a>
                    @*<a>
                            欢迎你，来到新世界旅行网！
                        </a>*@
                }
                else
                {
                    <a href="/Home/User_Center">会员中心</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a> <span>|</span> <a href="/Login/LoginOut">退出</a> <span>|</span>
                    <a>
                        欢迎你，<span>@UserInfo.User_Name</span>来到新世界旅行网！
                    </a>
                }
            </div>
        </div>
    </div>
    <div class="head_w">
        <div class="head_t clearfix">
            <div class="logo"><img src="~/images/logo.jpg"></div>
            <div class="rx_line"><img src="~/images/rx.jpg"></div>
        </div>
    </div>
    <div class="mainNav clearfix">
        <ul class="Nav_ul">
            <li><a href="/Home/Index">首页</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Route">旅游路线</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Scenic">旅游景点</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/CateringAccommodation">餐饮住宿</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Traffic_DatailsOne">交通线路</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Group">旅游团购</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Specialty">地方特产</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/AutoGenerationIntro">自动生成简介</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Team_Join">团队简介</a><img src="~/images/nav_line.jpg"></li>
            <li class="cur"><a href="/Home/Itinerary_Details">行程导航</a></li>
        </ul>
    </div>
    <div class="b_wrap">
        <div class="current"><span>当前所在地：</span><a href="/Home/Index">首页</a> >> <a href="/Home/Itinerary_Details">行程导航</a> >> <a href="#">产品详情</a></div>
        <div class="clumn_w clearfix">
            <div class="clumn_l">
                <div class="clumn">
                    <div class="clumn_tit t01">国内热门景点</div>
                    <div class="clumn_con">
                        <div class="cln_w">
                            <p>热门城市</p>
                            <div class="cln_c clearfix">
                                <a href="#">北京</a>
                                <a href="#">上海</a>
                                <a href="#">厦门</a>
                                <a href="#">成都</a>
                                <a href="#">西安</a>
                                <a href="#">黄山</a>
                                <a href="#">香港</a>
                                <a href="#">青岛</a>
                                <a href="#">桂林</a>
                                <a href="#">深圳</a>
                                <a href="#">三亚</a>
                                <a href="#">杭州</a>
                                <a href="#">丽江</a>
                                <a href="#">南京</a>
                                <a href="#">重庆</a>
                                <a href="#">苏州</a>
                                <a href="#">张家界</a>
                            </div>
                        </div>
                        <div class="cln_w">
                            <p>景点认证</p>
                            <div class="cln_c clearfix">
                                <a href="#">5A级</a>
                                <a href="#">4A级</a>
                                <a href="#">3A级</a>
                                <a href="#">2A级</a>
                            </div>
                        </div>
                        <div class="cln_w">
                            <p>热门主题</p>
                            <div class="cln_c clearfix">
                                <a href="#">温泉</a>
                                <a href="#">古镇</a>
                                <a href="#">摄影</a>
                                <a href="#">滑雪</a>
                                <a href="#">海边</a>
                                <a href="#">美食</a>
                                <a href="#">登山</a>
                                <a href="#">主题公园</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="clumn_r01">
                <div class="gr_info">
                    <table width="710" border="0" cellspacing="0" cellpadding="0">
                        <caption>预订信息</caption>
                        <tbody>
                            <tr>
                                <td width="80" align="right">团购名称：</td>
                                <td width="500"><span style="width:20px">@groupInfo.Title.Substring(0, 20)</span>.....</td>
                            </tr>
                            <tr>
                                <td align="right">出发日期：</td>
                                <td>@OutDate</td>
                            </tr>
                            <tr>
                                <td align="right">成人：</td>
                                <td>@groupInfo.Price<span>元/位</span></td>
                            </tr>
                            @if (childrenNum > 0)
                            {
                                <tr>
                                    <td align="right">儿童：</td>
                                    <td>@childrenPrice<span>元/位</span></td>
                                </tr>
                            }
                            <tr>
                                <td align="right">游客人数:</td>
                                <td>成人：@AdultNum<span>人</span></td>
                            </tr>
                            @if (childrenNum > 0)
                            {
                                <tr>
                                    <td align="right">儿童：</td>
                                    <td>@childrenNum<span>人</span></td>
                                </tr>
                            }
                            <tr>
                                <td align="right">保险：</td>
                                <td>@Number<span>份</span>@xiaoji<span>.00元</span></td>
                            </tr>
                            <tr>
                                <td align="right">订单总价：</td>
                                <td>
                                    @if (total > 0)
                                    {<span id="totalPrice">755.00</span>}
                                </td>
                            </tr>
                            @*<tr>
                    <td align="right" valign="top">联系人姓名：</td>
                    <td>小鑫</td>
                </tr>
                <tr>
                    <td align="right" valign="top">备注：</td>
                    <td>18368182541</td>
                </tr>*@
                            <tr>
                                <td align="right" valign="top">支付方式：</td>
                                <td>支付宝 （***3414）@*招商银行（***2134）*@</td>
                            </tr>
                            <tr>
                                <td align="right" valign="top"></td>
                                <td><a id="CommitOrder"><img src="~/images/tjdd.jpg"></a></td>
                            </tr>
                        </tbody>
                    </table>
                    <input type="hidden" ID="Order_No" name="OrderNo" value="" />
                    <input type="hidden" id="Order_ProInfo" name="OrderNo" value="@groupInfo.Title" />
                    <input type="hidden" id="Order_Content" name="OrderNo" value="@groupInfo.Tour_Desc" />
                    <input type="hidden" id="Order_PictureUrl" name="OrderNo" value="@groupInfo.Pic_Url" />
                    <input type="hidden" id="Order_OutingTime" name="OrderNo" value="@groupInfo.StartTime" />
                </div>
        </div>
    </div>
</div>
    </div>
    </div>
</body>
</html>
<script>
    $(function () {
        //显示总价
        $("#totalPrice").text(@total);
    });
    //提交订单时向订单表添加一条记录 状态默认是未付款  同时跳转下一个页面
    $("#CommitOrder").on('click', function () {
        var OrderInfo = {};
        OrderInfo.Order_No = $("#Order_No").val();
        OrderInfo.Order_ProInfo = $("#Order_ProInfo").val();
        OrderInfo.Order_Money = @total;
        OrderInfo.Order_Type = "团购";
        OrderInfo.Order_Status = 0;
        OrderInfo.Order_Name = "乐途旅游社";
        OrderInfo.Orde_PictureUrl = $("#Order_PictureUrl").val();
        OrderInfo.Order_OutingTime = $("#Order_OutingTime").val();
        OrderInfo.Order_Content = $("#Order_Content").val();
        $.ajax({
            url: "/Order/AddGroupOrderInfo",
            type: "post",
           // data: OrderInfo,
            data: {
                q: "javascript",//设置允许jquery调用ajax 否则会报错提示非法调用ajax
                count: 1,
                OrderInfo
            },
            success: function (result) {
                if (result.Success) {
                    var Order_No = $("#Order_No").val();
                    var action = "/Home/Group_Payment?Desc="+$("#Order_Content").val()+"&total=@total&title="+$("#Order_ProInfo").val()+"&Order_No="+Order_No;
                    window.location = action;
                }
            }
        });
    });
    //动态生成订单号
    function GetDateNow() {
        var vNow = new Date();
        var sNow = "";
        sNow += String(vNow.getFullYear());
        sNow += String(vNow.getMonth() + 1);
        sNow += String(vNow.getDate());
        sNow += String(vNow.getHours());
        sNow += String(vNow.getMinutes());
        sNow += String(vNow.getSeconds());
        sNow += String(vNow.getMilliseconds());
        document.getElementById("Order_No").value = sNow;
    }
    GetDateNow();
</script>

